<?php
/**
* Display the user preferences
*
* @author       Fabrice Douteaud <clearbudget@douteaud.com>
* @package      snippets
* @access       public
*/

/***********************************************************************

  Copyright (C) 2008  Fabrice douteaud (clearbudget@douteaud.com)

    This file is part of ClearBudget.

    ClearBudget is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ClearBudget is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ClearBudget.  If not, see <http://www.gnu.org/licenses/>.


************************************************************************/
class_settings::getSettings();
if(!isset($setupDone)) $setupDone = class_settings::setupDone();
?>
<div class="title"><?php echo $keys->pageTitle_accountSettings; ?></div><br/>
<?php if(!$setupDone && $_SERVER["REQUEST_METHOD"]=='POST') { ?>
<blockquote>
<?php echo $keys->error_MissingMandatoryUserSettings; ?>
</blockquote><br/>
<?php } ?>
<?php if($setupDone && $settingsSuccess == true && !$badUsername && !$badPassword) { ?>
<blockquote>
<?php echo $keys->error_UserSettingsSuccess; ?>
</blockquote><br/>
<?php } ?>
<?php if($badUsername || $badPassword) { ?>
<blockquote>
<?php echo $keys->error_InvalidUsernameOrPassword; ?>
</blockquote><br/>
<?php } ?>

<form action="index.php" method="post">
<input type="hidden" name="action" value="settings">
<table class="tableReport" onMouseOver="javascript:trackTableHighlight(event, '#E6EAE9');" onMouseOut="javascript:highlightTableRow(0);">
<!--<caption><?php echo $keys->pageTitle_accountSettings; ?></caption>-->
<tr>
  <th><?php echo $keys->text_settingName; ?></th>
  <th><?php echo $keys->text_settingInput; ?></th>
</tr>
<tr><td><?php echo $keys->text_login; ?></td>
<td><input type="text" value="<?php echo class_settings::$username; ?>" name="username" id="login"></td></tr>
<tr><td><?php echo $keys->text_password; ?></td>
<td><input type="password" value="<?php echo class_settings::$password; ?>" name="password" id="password"></td></tr>
<tr><td><?php echo $keys->text_secureAccess; ?></td>
<td><select name="secureAccess" id="secureAccess">
<option value='0' <?php if(class_settings::$secureAccess === '0') echo 'selected';?>><?php echo $keys->text_no; ?></option>
<option value='1' <?php if(class_settings::$secureAccess == 1) echo 'selected';?>><?php echo $keys->text_yes; ?></option>
</select></td></tr>
<tr><td><?php echo $keys->text_language; ?>*</td>
<td><select name="language" id="language">
<option value='NULL'><?php echo $keys->link_pickInTheList; ?></option>
<option value='fr' <?php if(class_settings::$language == 'fr') echo 'selected';?>><?php echo $keys->link_SetLanguageFR; ?></option>
<option value='en' <?php if(class_settings::$language == 'en') echo 'selected';?>><?php echo $keys->link_SetLanguageEN; ?></option>
<option value='tr' <?php if(class_settings::$language == 'tr') echo 'selected';?>><?php echo $keys->link_SetLanguageTR; ?></option>
</select></td></tr>
<tr><td><?php echo $keys->text_currency; ?>*</td>
<td><select name="currency" id="currency">
<option value='NULL'><?php echo $keys->link_pickInTheList; ?></option>
<option value='euro' <?php if(class_settings::$currency == 'euro') echo 'selected';?>><?php echo $keys->text_euro; ?></option>
<option value='dollar' <?php if(class_settings::$currency == 'dollar') echo 'selected';?>><?php echo $keys->text_dollar; ?></option>
</select></td></tr>
<tr><td colspan="2"  style="text-align:center" ><input type="submit" class="submit" name="submit" value="Go"></td></tr>
</table>
</form>
